﻿using UtilZ.Dotnet.Ex.Audio;

namespace UtilZ.Dotnet.AudioPlayer.Recorder
{
    /// <summary>
    /// 录音选项
    /// </summary>
    public class SoundRecorderOptions
    {

        /// <summary>
        /// 录音设备索引,
        /// -1 = default device, 
        /// 0 = first. BASS_RecordGetDeviceInfo can be used to enumerate the available devices
        /// </summary>
        public int DeviceId { get; set; } = -1;

        /// <summary>
        /// 采样率
        /// </summary>
        public int SampleRate { get; set; } = 48000;

        /// <summary>
        /// 声道数
        /// </summary>
        public int Chans { get; set; } = 1;

        /// <summary>
        /// 录音数据输出间隔,单位/毫秒,默认100.最小值5ms,the maximum the maximum is half the BASS_CONFIG_REC_BUFFER setting.
        /// 小于等于0使用默认值
        /// </summary>
        public int Period { get; set; } = 100;

        /// <summary>
        /// 采样位数
        /// </summary>
        public int SampleBits { get; set; } = DataSampleBits.BIT16;




        /// <summary>
        /// 构造函数
        /// </summary>
        public SoundRecorderOptions()
        {

        }


        private static SoundRecorderOptions _default = null;
        /// <summary>
        /// 获取默认选项
        /// </summary>
        public static SoundRecorderOptions Default
        {
            get
            {
                if (_default == null)
                {
                    _default = new SoundRecorderOptions();
                }

                return _default;
            }
        }
    }
}
